
# Severity in ug3_no_imp

# Justice prefs 

jp_1 <- lm(more_severe_punishment ~ woman + community, ug3_no_imp) 
jp_2 <- lm(punish_then_and_there ~ woman + community, ug3_no_imp) 
jp_3 <- lm(sfmv ~ woman + more_severe_punishment + community, ug3_no_imp) 
jp_4 <- lm(sfmv ~ woman + punish_then_and_there + community, ug3_no_imp) 
jp_5 <- lm(sfmv ~ woman + punish_then_and_there + more_severe_punishment + community, ug3_no_imp) 


# Get HC1 robust standard errors from estimatr package
ses<- starprep(jp_1,
               jp_2,
               jp_3,
               jp_4,
               jp_5, stat = "std.error",se_type = "HC1")

pvals<- starprep(jp_1,
                 jp_2,
                 jp_3,
                 jp_4,
                 jp_5, stat = "p.value",se_type = "HC1")

sink("04_manuscript/tables/justice_prefs_no_imp.tex")
stargazer(
  jp_1,
  jp_2,
  jp_3,
  jp_4,
  jp_5,
  se = ses,
  p = pvals,
  # type = "text",
  no.space = TRUE,
  covariate.labels = c("Woman", "Should punish more severely","Should punish more swiftly"),
  dep.var.labels = c("Should punish more severely","Should punish more swiftly","Mob Should Beat Thief"),
  # "Mob Should Kill Thief"),
  # "Mob Should Beat Thief","Mob Should Kill Thief",
  # "Mob Should Beat Thief","Mob Should Kill Thief"
  # ),
  add.lines = list(c("Avg. men", 
                     with(subset(ug3_no_imp, woman == 0), round(mean(more_severe_punishment, na.rm = TRUE),2)),
                     with(subset(ug3_no_imp, woman == 0), round(mean(punish_then_and_there, na.rm = TRUE),2)),
                     with(subset(ug3_no_imp, woman == 0), round(mean(sfmv, na.rm = TRUE),2)),
                     with(subset(ug3_no_imp, woman == 0), round(mean(sfmv, na.rm = TRUE),2)),
                     with(subset(ug3_no_imp, woman == 0), round(mean(sfmv, na.rm = TRUE),2))
  )
  ),
  omit.stat = c("rsq","f","ser"),
  omit = c("Constant","community"),
  float = FALSE
)
sink()


rm(jp_1,
   jp_2,
   jp_3,
   jp_4,
   jp_5,ses,pvals)













